package com.jeomo.mem.starter.service;

import com.jeomo.masterdata.starter.enums.UseScopeEnum;
import com.jeomo.mem.starter.dto.MemberPointRuleDto;
import com.jeomo.mem.starter.entity.MemberPointsRule;
import com.jeomo.mem.starter.entity.MemberPointsRuleExe;
import com.jeomo.mem.starter.entity.MemberPointsRuleList;

import java.util.List;

/**
 * 会员积分服务
 * @author:Jackpot
 * @create 2020-09-04 14:59
 * @description:
 */
public interface IMemberPointsService {

    /**
     * 保存积分规则 :新增/修改
     * @param memberPointsRule
     * @param memberPointsRuleList
     */
    int saveRule(MemberPointsRule memberPointsRule, List<MemberPointsRuleList> memberPointsRuleList);


    /**
     * 保存积分规则 :新增/修改
     * @param memberPointsRule
     * @param memberPointsRuleList
     * @param addOrUpdate true 为新增,false 为修改
     * @return
     */
    int saveRule(MemberPointsRule memberPointsRule, List<MemberPointsRuleList> memberPointsRuleList,boolean addOrUpdate);

    /**
     * 新增积分规则明细
     * @param memberPointsRule
     * @param memberPointsRuleList
     * @return
     */
    int insertRuleDetail(MemberPointsRule memberPointsRule,List<MemberPointsRuleList> memberPointsRuleList);


    /**
     * 删除积分规则
     * @param ruleCode
     * @return
     */
    int deleteRule(String ruleCode);

    /**
     * 删除积分规则执行单
     * @param ruleCode 规则明细ID
     * @return
     */
    int deleteRuleExe(String ruleCode);


    /**
     * 删除积分规则明细
     * @param ruleCode 规则ID
     * @return
     */
    int deleteRuleDetail(String ruleCode);

    /**
     * 获取一条会员积分规则的详情信息
     * @param ruleCode
     * @return
     */
    MemberPointRuleDto getMemberPointRule(String ruleCode);



    /**
     * 获取所有积分规则
     * @return
     */
    List<MemberPointsRule> getAllPointRules();

    /**
     * 查询符合的积分规则
     * @param levelCode
     * @param goodsCode 商品编码
     * @return 积分规则
     */
    MemberPointsRuleExe getPointsRuleByGoods(String levelCode, String goodsCode);

    MemberPointsRuleExe getPointsRuleByMerchant(String levelCode,String merchantCode);

    /**
     * 计算积分
     *
     * @param levelCode 会员等级
     * @param bsCode 业务编码
     * @param amount    消费金额
     * @param useScopeEnum    使用范围
     * @return
     */
    int getPoints(String levelCode,String bsCode,double amount, UseScopeEnum useScopeEnum);

    int getPoints(MemberPointsRuleExe memberPointsRuleExe, double amount);

}
